//
//  MYMenuViewController.m
//  奇闻
//
//  Created by 似水灵修 on 14-11-20.
//  Copyright (c) 2014年 MingYueGuCheng. All rights reserved.
//

#import "MYMenuViewController.h"
#import "MYMenuTableViewCell.h"
#import "MYFind.h"


@interface MYMenuViewController ()
@property (nonatomic, strong) NSMutableArray *menus;
@end

@implementation MYMenuViewController
static NSString * const ID = @"MYMenuTableViewCell";

- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem *chat = [[UIBarButtonItem alloc] initWithTitle:@"发送" style:UIBarButtonItemStyleBordered  target:nil action:nil];
    self.navigationItem.rightBarButtonItem = chat;
    UIBarButtonItem *writ = [[UIBarButtonItem alloc] initWithTitle:@"撰写" style:UIBarButtonItemStyleBordered  target:nil action:nil];
    self.navigationItem.leftBarButtonItem = writ;
    
    [self.tableView registerClass:[MYMenuTableViewCell class] forCellReuseIdentifier:ID];
    self.view.backgroundColor = [UIColor clearColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    MYBaseMenu *findMenu = [[MYFind alloc] init];
    [self.menus addObject:findMenu];
    
}

- (NSMutableArray *)menus
{
    if (nil == _menus) {
        _menus = [NSMutableArray array];
    }
    return _menus;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.menus.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MYMenuTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ID forIndexPath:indexPath];
    MYBaseMenu *menu = self.menus[indexPath.row];
    cell.menu = menu;
    return cell;
}
@end
